<?php

/**
 * Transactions form base class.
 *
 * @method Transactions getObject() Returns the current form's model object
 *
 * @package    billingSystem
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseTransactionsForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'transid'       => new sfWidgetFormInputHidden(),
      'custfname'     => new sfWidgetFormInputText(),
      'custlname'     => new sfWidgetFormInputText(),
      'pid'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Partner'), 'add_empty' => false)),
      'proid'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Products'), 'add_empty' => false)),
      'paidtransfees' => new sfWidgetFormInputText(),
      'date'          => new sfWidgetFormDateTime(),
      'invid'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Invoice'), 'add_empty' => true)),
      'created_at'    => new sfWidgetFormDateTime(),
      'updated_at'    => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'transid'       => new sfValidatorChoice(array('choices' => array($this->getObject()->get('transid')), 'empty_value' => $this->getObject()->get('transid'), 'required' => false)),
      'custfname'     => new sfValidatorString(array('max_length' => 250)),
      'custlname'     => new sfValidatorString(array('max_length' => 250)),
      'pid'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Partner'))),
      'proid'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Products'))),
      'paidtransfees' => new sfValidatorInteger(),
      'date'          => new sfValidatorDateTime(),
      'invid'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Invoice'), 'required' => false)),
      'created_at'    => new sfValidatorDateTime(),
      'updated_at'    => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('transactions[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Transactions';
  }

}
